<html>
<head><meta charset="utf-8"><title>Before we restart work · t-compiler/wg-rfc-2229 · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/index.html">t-compiler/wg-rfc-2229</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/Before.20we.20restart.20work.html">Before we restart work</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="206075126"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/Before%20we%20restart%20work/near/206075126" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/Before.20we.20restart.20work.html#206075126">(Aug 05 2020 at 20:38)</a>:</h4>
<p>Just leaving some notes here/ things it would be nice to have feedback on for once we start work again (no rush). </p>
<ul>
<li>
<p>Order in which we need to finish the issues currently being worked on:<br>
 1)  <a href="https://github.com/rust-lang/project-rfc-2229/issues/15">https://github.com/rust-lang/project-rfc-2229/issues/15</a> <br>
 2) <a href="https://github.com/rust-lang/project-rfc-2229/issues/4">https://github.com/rust-lang/project-rfc-2229/issues/4</a> <br>
 3) <a href="https://github.com/rust-lang/project-rfc-2229/issues/7">https://github.com/rust-lang/project-rfc-2229/issues/7</a><br>
15 before 4 because we need to pass certain test cases related to information in the compiler output<br>
4 before 7 because that lets us discard unused captures.</p>
</li>
<li>
<p><a href="https://github.com/rust-lang/project-rfc-2229/pull/16">https://github.com/rust-lang/project-rfc-2229/pull/16</a> contains the details about ignoring <code>let _ = var</code> as a capture.  If this looks good, we should probably open a PR on rust-lang/rust to collect more feedback<br>
Maybe even this should/needs to be accepted before 7.</p>
</li>
<li>
<p><a href="https://github.com/rust-lang/rust/pull/72465">https://github.com/rust-lang/rust/pull/72465</a> PR relies on upvars instead of paths (which makes sense given the current compiler). In original plan draft it was listed that liveness should use closure captures. I haven't gone through the code in passes/liveness.rs in depth but does our change to use Place affect it and if so what's the impact? </p>
</li>
<li>
<p>Do we need to document the <a href="#narrow/stream/189812-t-compiler.2Fwg-rfc-2229/topic/minimal.20capture.20.239.3A.20interesting.20example/near/205673496">example here</a> somewhere?</p>
</li>
</ul>
<p>Based on the comment here: <a href="https://github.com/rust-lang/rfcs/pull/2229#issuecomment-360901580">https://github.com/rust-lang/rfcs/pull/2229#issuecomment-360901580</a> about doing something like</p>
<div class="codehilite"><pre><span></span><code><span class="p">{</span><span class="w"></span>
<span class="w">   </span><span class="kd">let</span><span class="w"> </span><span class="n">r</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&amp;</span><span class="n">a</span><span class="p">.</span><span class="n">b</span><span class="p">.</span><span class="n">c</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="n">NewClosure</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">r</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>


<p>It feels like such a thing won't be supported because alias_id1 and alias_id2 conflict</p>
<div class="codehilite"><pre><span></span><code><span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">     </span><span class="kd">let</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">p</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Point</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">x</span>: <span class="mi">10</span><span class="p">,</span><span class="w"> </span><span class="n">y</span>: <span class="mi">20</span><span class="w"> </span><span class="p">};</span><span class="w"></span>
<span class="w">     </span><span class="kd">let</span><span class="w"> </span><span class="n">alias_id1</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="n">p</span><span class="p">;</span><span class="w"></span>
<span class="w">     </span><span class="kd">let</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">c1</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">||</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">          </span><span class="p">(</span><span class="o">*</span><span class="n">alias_id1</span><span class="p">).</span><span class="n">x</span><span class="w"> </span><span class="o">+=</span><span class="w"> </span><span class="mi">10</span><span class="p">;</span><span class="w"></span>
<span class="w">          </span><span class="n">println</span><span class="o">!</span><span class="p">(</span><span class="s">&quot;{:?}&quot;</span><span class="p">,</span><span class="w"> </span><span class="o">*</span><span class="n">alias_id1</span><span class="p">);</span><span class="w"></span>
<span class="w">     </span><span class="p">};</span><span class="w"></span>

<span class="w">     </span><span class="kd">let</span><span class="w"> </span><span class="n">alias_id2</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&amp;</span><span class="n">p</span><span class="p">.</span><span class="n">y</span><span class="p">;</span><span class="w"></span>
<span class="w">     </span><span class="kd">let</span><span class="w"> </span><span class="n">c2</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">||</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">          </span><span class="n">println</span><span class="o">!</span><span class="p">(</span><span class="s">&quot;{}&quot;</span><span class="p">,</span><span class="w"> </span><span class="o">*</span><span class="n">alias_id2</span><span class="p">);</span><span class="w"></span>
<span class="w">     </span><span class="p">};</span><span class="w"></span>

<span class="w">     </span><span class="n">c1</span><span class="p">();</span><span class="w"></span>
<span class="w">     </span><span class="n">c2</span><span class="p">();</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="206218145"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/Before%20we%20restart%20work/near/206218145" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/Before.20we.20restart.20work.html#206218145">(Aug 07 2020 at 02:15)</a>:</h4>
<p>Also <a href="https://github.com/rust-lang/rust/pull/74314#issuecomment-660581970">https://github.com/rust-lang/rust/pull/74314#issuecomment-660581970</a> is on hold which would affect <a href="https://github.com/rust-lang/rust/issues/4">#4</a> timeline.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>